package com.wiscamp.ninechapters.problems.domain.repositories;

import com.wiscamp.ninechapters.problems.domain.models.problems.problems.CompositeProblem;
import com.wiscamp.ninechapters.problems.domain.models.problems.problems.HybridProblem;
import com.wiscamp.ninechapters.problems.domain.models.problems.problems.Problem;
import com.wiscamp.ninechapters.problems.domain.models.problems.problems.SimpleProblem;
import cube.ddd.common.query.PagedObjects;
import cube.ddd.common.query.PagedQuery;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;

import java.util.Collection;

public interface ProblemRepository {

    Problem getProblem(long problemId);

    Collection<Problem> getProblemsByIds(Collection<Long> problemIds);

    PagedObjects<Problem> getProblemsByQuery(@NotNull PagedQuery query);

    // Collection<Problem> getSortedProblemsByDifficulty(@NotEmpty Collection<Long> problemIds);

    Collection<Long> getSortedProblemIdsByDifficulty(@NotEmpty Collection<Long> problemIds);

    Collection<Long> getProblemIdsByPointAndDifficulty(@NotEmpty Collection<Long> pointIds, @Min(0) int startDifficulty,
                                                       @Min(0) int endDifficulty);

    Collection<Long> getProblemIdsByTagAndDifficulty(@NotEmpty Collection<Long> tagIds, @Min(0) int startDifficulty,
                                                     @Min(0) int endDifficulty);

    boolean updateProblem(@NotNull Problem problem);

    SimpleProblem createSimpleProblem(@NotNull SimpleProblem problem);

    void updateSimpleProblem(@NotNull SimpleProblem problem);

    Problem createCompositeProblem(@NotNull CompositeProblem compositeProblem);

    void updateCompositeProblem(@NotNull CompositeProblem compositeProblem);

    Problem createHybridProblem(@NotNull HybridProblem hybridProblem);

    void updateHybridProblem(@NotNull HybridProblem hybridProblem);
}
